package com.genius.demo.rabbitmqprovider.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ModelMessageConfig {

    private final String convertQueue = "topic.convert";

    private final String componentQueue = "topic.component";

    private final String convertRoutingKey = "topic.convert.route";

    private final String componentRoutingKey = "topic.component.route";

    @Bean
    Queue convertQue() {
        return new Queue(convertQueue);
    }

    @Bean
    Queue componentQue() {
        return new Queue(componentQueue);
    }

    @Bean
    TopicExchange modelExchange() {
        return new TopicExchange("ModelExchange");
    }

    @Bean
    Binding bindingConvert() {
        return BindingBuilder.bind(convertQue()).to(modelExchange()).with(convertRoutingKey);
    }

    @Bean
    Binding bindingComponent() {
        return BindingBuilder.bind(componentQue()).to(modelExchange()).with(componentRoutingKey);
    }
}
